var FormController = BaseController.extend({
	init : function($scope) {
		this._super($scope)
		
		this.$scope.getValidationClass = this._getValidationClass.bind(this);
		this.$scope.isValidatedOf = this._isValidatedOf.bind(this);
	},

	_getValidationClass : function(ngModelController, eClass, sClass) {
		
		if (ngModelController != undefined && ngModelController.$dirty) {
			var errorClass = eClass || 'state-error';
			var succussClass = sClass || 'state-success';

			return ngModelController.$invalid ? errorClass : succussClass;
		} else {
			return '';
		}
	},

	_isValidatedOf : function(ngModelController, validationTypes) {
		if (ngModelController != undefined && ngModelController.$dirty) {
			validationTypes = validationTypes || [];

			if (typeof validationTypes === 'string') {
				validationTypes = [ validationTypes ];
			}

			return validationTypes.reduce(function(isInvalidated, type) {

				return isInvalidated || ngModelController.$error[type];

			}, false);
		} else {
			return false;
		}
	}
})

FormController.$inject = ['$scope'];